package com.drojian.demo1.myself;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.drojian.demo.R;

public class MyView extends View {
    Paint paint= new Paint(Paint.ANTI_ALIAS_FLAG);
    int color = R.color.accent_peach;
    public MyView(Context context) {
        super(context);
    }

    public MyView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public MyView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


    private void initDraw(){
        paint.setColor(color);
        paint.setStrokeWidth((float) 1.5);

    }


    @Override
    protected void onDraw(@NonNull Canvas canvas) {
        super.onDraw(canvas);


        canvas.drawARGB(1,1,1,1);
        int width = getWidth();
        int height = getHeight();
        canvas.drawRect(0,0,width,height,paint);
    }
}
